local youying = fk.CreateSkill{
    name = "ym2__youyin",
    tags = {Skill.Wake}
}
Fk:loadTranslationTable{
    ["ym2__youyin"] = "忧隐",
    [":ym2__youyin"] = "觉醒技，一号位的回合结束时，存活角色座次号顺时针移动一位。",

    ["$ym2__youyin1"] = "吾家累世蒙恩，凡恃宠骄恣者，朕必诏有司按治。",
    ["$ym2__youyin2"] = "万民膏血尽付人主，唯愿汝能存仁孝。",
}
youying:addEffect(fk.TurnEnd,{
    anim_type = "big",
    can_trigger = function (self, event, target, player, data)
        return player:hasSkill(youying.name) and player:usedSkillTimes(youying.name,Player.HistoryGame) == 0
    end,
    can_wake = function (self, event, target, player, data)
        return target and target.seat == 1
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        local targets,tos,death = {},{},{}
        for index, cp in ipairs(room.players) do
            table.insert(tos,cp.id)
            if cp.dead then
                table.insert(death,cp.id)
            end
        end
        local shiftRemainingElements = function(arr, excluded_indices)
            local positions = {}
            -- 收集未被排除的索引
            for index, value in ipairs(arr) do
                if not table.contains(excluded_indices,value) then
                    table.insert(positions, index)
                end
            end
        
            -- 收集对应的值
            local values = {}
            for _, pos in ipairs(positions) do
                table.insert(values, arr[pos])
            end
        
            -- 循环左移一位
            local shifted_values = {}
            if #values > 0 then
                shifted_values = {table.unpack(values, 2)}
                table.insert(shifted_values, values[1])
            end
        
            -- 更新原数组
            for i, pos in ipairs(positions) do
                arr[pos] = shifted_values[i]
            end
        
            return arr
        end
        local new_tos = shiftRemainingElements(tos,death)
        for _, id in ipairs(new_tos) do
            table.insert(targets,room:getPlayerById(id))
        end

        room.players = targets
        room:arrangeSeats()
    end,
})
return youying